package com.atguigu.day06.test;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/5 11:33
 * @注释
 */
class DoubleArrayExer1{
    public static void main(String[] args) {
        int[][] arr = new int[6][];

        for (int i = 0; i < arr.length; i++) {
            arr[i] = new int[i+1];
            for (int j = 0; j < i+1; j++) {
                arr[i][j] = i + 1 ;
                System.out.print(arr[i][j] + " ");
            }
            System.out.println();
        }


    }
}



public class DoubleArrayExer {
    public static void main(String[] args) {
        int[][]arr = {{10, 11, 12, 13},{33, 44, 11, 55},{99, 88, 77, 23, 45}};
        int temp = arr[0][0];
        int sum = 0;
        int num = 0;
        for(int[] eArr:arr){
            for(int e:eArr){
                if(e > temp){
                    temp = e;
                }
                if(e % 2 == 0){
                    sum += e;
                }
                if(e % 2 == 1){
                    num += e;
                }
            }
        }
        /*for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                if (arr[i][j] > temp) {
                    temp = arr[i][j];
                }
                if(arr[i][j] % 2 == 0) {
                    sum += arr[i][j];
                }
                if(arr[i][j] % 2 == 1) {
                    num += arr[i][j];
                }
            }
        }*/
        System.out.println("最大值为:" + temp);
        System.out.println("偶数的和为: " + sum);
        System.out.println("奇数的和为: " + num);
    }
}
